import { ADD_CHAT, ADD_TODO, TOGGLE_TODO, SET_FILTER, COUNTER } from "./actionTypes";

let nextTodoId = 0;


export const addChat = chatContent => ({
  
  type: ADD_CHAT,
  payload: chatContent
  
});

export const incrementCounter = counter => ({
  type: COUNTER,
  payload: {
    counter: counter
  }
});

export const addTodo = content => ({
  type: ADD_TODO,
  payload: {
    id: ++nextTodoId,
    content
  }
});

export const toggleTodo = id => ({
  type: TOGGLE_TODO,
  payload: { id }
});

export const setFilter = filter => ({ type: SET_FILTER, payload: { filter } });
